import os
import time

source_list = [r'D:\mysite',r'D:\Apps']
target_dir = r'D:\back'+os.sep
day = time.strftime('%Y%m%d')
if not os.path.exists(target_dir+day):
	os.mkdir(target_dir+day)
	print 'make dir'+target_dir+day
comment = raw_input('input comment:')
if len(comment) == 0:
	target = target_dir+ day+os.sep + time.strftime('%H%M%S') + '.zip'
else:
	target = target_dir + day + os.sep + time.strftime('%H%M%S') + '_'+comment + '.zip'
zip_command = 'zip -qr %s %s' % (target , ' '.join(source_list))
if os.system(zip_command) == 0:
	print 'backup successful'
else:
	print 'backup fail'
